package com.kzf.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.kzf.mapper.OperateLogMapper;
import com.kzf.pojo.LogPageResult;
import com.kzf.pojo.LogQueryParam;
import com.kzf.pojo.OperateLog;
import com.kzf.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public LogPageResult getLogList(LogQueryParam logQueryParam){
        PageHelper.startPage(logQueryParam.getPage(), logQueryParam.getPageSize());
        List<OperateLog> list = operateLogMapper.getLog();
        Page<OperateLog> p =(Page<OperateLog>) list;
        return new LogPageResult(p.getTotal(),p.getResult());
    }
}
